﻿<!-- 调课管理-调课审核 -->
<template>
    <div>
        <!--<div class="btn-add">
        <button type="button" class="btn btn-success btn-lg" @click="shtkmodel()"><i class="iconfont icon-chenggong ft12 mr5"></i>审核调课</button>
        <button type="button" class="btn btn-danger btn-lg" @click="deltk()"><i class="iconfont icon-shanchu ft12 mr5"></i>删除调课记录</button>

    </div>-->

        <div class="row" style="height:40px;margin:10px">

            <div class="col-xs-3 padding20" style="padding-bottom:10px">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">学期</button>
                    </div>
                    <base-xq :pzoption="query.xq"></base-xq>

                </div>
            </div>
            <div class="col-xs-3 padding20" style="padding-bottom:10px">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">课程系部</button>
                    </div>
                    <base-xb :pzoption="query.xb" isqx isdx iskc></base-xb>

                </div>
            </div>


            <div class="col-xs-3 padding20" style="padding-bottom:10px">
                <div class="input-group" style="margin-bottom:10PX;">
                    <div class="input-group-btn">
                        <button type="button" style="height: 34px;min-width:80PX" class="btn btn-primary  dropdown-toggle">审核状态</button>
                    </div>
                    <el-select placeholder="审核状态" size="mini" v-model="query.shzt" class="form-control filter" style="height: 34px;padding:0px">
                        <el-option label="未审核" value="0"></el-option>
                        <el-option label="已审核" value="1"></el-option>
                    </el-select>

                </div>
            </div>
        </div>
        <div class="row" style="margin:10px">

            <div class="col-xs-12 padding20" style="padding-bottom:5px">
                <el-tabs type="card">
                    <el-tab-pane>
                        <span slot="label"><i class="el-icon-s-goods"></i>调课审核<el-badge :value="tableop.dataset.length" /></span>
                        <el-row :gutter="20">
                            <el-col :span="24" style="text-align:right">
                                <el-button @click="shtkmodel()" size="medium" type="success">审核调课</el-button>
                                <el-button @click="deltk()" size="medium" type="danger">删除调课记录</el-button>

                            </el-col>
                        </el-row>
                        <base-table :pzoption="tableop" @selection-change="handleSelectionChange">
                        </base-table>
                    </el-tab-pane>
                    <el-tab-pane>
                        <span slot="label"><i class="el-icon-s-custom"></i>代课审核 <el-badge :value="tableop1.dataset.length" /></span>
                        <el-row :gutter="20">
                            <el-col :span="24" style="text-align:right">
                                <el-button @click="shdkmodel()" size="medium" type="success">审核代课</el-button>
                                <el-button @click="deldk()" size="medium" type="danger">删除代课记录</el-button>

                            </el-col>
                        </el-row>
                        <base-table :pzoption="tableop1" @selection-change="handleSelectionChange1">
                        </base-table>
                    </el-tab-pane>

                </el-tabs>
            </div>

        </div>



        <div class="modal fade dx" id="ZGModal" role="dialog">
            <div class="modal-dialog" role="document" style="width: 500px">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">
                            审核调课记录
                        </h4>
                    </div>
                    <div class="modal-body" style="min-height: 100px;text-align: left; margin-top: 50PX;">
                        <el-radio-group v-model="shzt">
                            <el-radio :label="0">不同意</el-radio>
                            <el-radio :label="1">同意</el-radio>
                        </el-radio-group>
                        <el-input type="text" style="margin-top:20px"
                                  placeholder="请输入意见"
                                  v-model="shyj" maxlength="20" show-word-limit>
                        </el-input>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-info" @click="tksh()">确认</button>

                    </div>
                </div>
            </div>
        </div>

        <div class="modal fade dx" id="ZGModal1" role="dialog">
            <div class="modal-dialog" role="document" style="width: 500px">
                <div class="modal-content">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                        <h4 class="modal-title">
                            审核代课记录
                        </h4>
                    </div>
                    <div class="modal-body" style="min-height: 100px;text-align: left; margin-top: 50PX;">
                        <el-radio-group v-model="shztdk">
                            <el-radio :label="0">不同意</el-radio>
                            <el-radio :label="1">同意</el-radio>
                        </el-radio-group>
                        <el-input type="text" style="margin-top:20px"
                                  placeholder="请输入意见"
                                  v-model="shyjdk" maxlength="20" show-word-limit>
                        </el-input>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default" data-dismiss="modal">关闭</button>
                        <button type="button" class="btn btn-info" @click="dksh()">确认</button>

                    </div>
                </div>
            </div>
        </div>
        <!-- 表格 -->



    </div>
</template>

<script>
    module.exports = {
        props: ['pdata'],
        components: {
            'base-table': httpVueLoader('/ViewV5/Base/Vue/Table.vue'),
            'base-xq': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxq.vue'),
            'base-xb': httpVueLoader('/ViewV5/AppPage/QJJW/component/conxb.vue?v=2')
        },
        data: function () {
            return {
                search: "",
                kcdm: "",
                jssl: 0,
                shzt: 0,
                shyj: "",
                shztdk: 0,
                shyjdk: "",
                jcdataset: [],
                query: {
                    zc: "1",
                    shzt: "0",
                    xq: { value: "" },
                    xb: { value: [] },
                },
                js: { value: "" },
                alldata: [],
                seljc: { jcmc: "", isbn: "" },
                tableop: {
                    title: "调课信息",
                    issel: true,
                    iscz: false,
                    height: 500,
                    isxh: true,
                    dataset: [],
                    loading: true,
                    multipleSelection: [],
                    collist: [
                        { colid: "kcmc", colname: "课程名称", isshow: true, istip: true },
                        { colid: "kcdm", colname: "课程代码", isshow: false, istip: true, nosort: true },
                        { colid: "jsmc", colname: "上课教师", isshow: true, istip: true },
                        { colid: "hbbj", colname: "上课班级", isshow: true, istip: true },
                        { colid: "SKXX", colname: "原上课时间", isshow: true, istip: false, width: "160" },
                        { colid: "dKXX", colname: "调课后时间", isshow: true, istip: false, width: "160" },
                        { colid: "jse", colname: "原上课教室", isshow: true, istip: false },
                        { colid: "dkjse", colname: "调课后教室", isshow: true, istip: false },
                        { colid: "dkyy", colname: "调课原因", isshow: true, istip: true },
                        { colid: "CRDate", colname: "申请时间", isshow: true, istip: true },
                        { colid: "shsj", colname: "审核时间", isshow: true, istip: true },
                        { colid: "shyj", colname: "审核意见", isshow: true, istip: true },
                        { colid: "xbmc", colname: "系部名称", isshow: true, istip: true },
                        { colid: "xq", colname: "学期", isshow: true, istip: true, nosort: true },


                    ]
                },
                tableop1: {
                    title: "代课审核",
                    issel: true,
                    iscz: false,
                    height: 500,
                    isxh: true,
                    dataset: [],
                    loading: true,
                    multipleSelection: [],
                    collist: [
                        { colid: "kcmc", colname: "课程名称", isshow: true, istip: true },
                        { colid: "kcdm", colname: "课程代码", isshow: false, istip: true, nosort: true },
                        { colid: "jsmc", colname: "上课教师", isshow: true, istip: true },
                        { colid: "hbbj", colname: "上课班级", isshow: true, istip: true },
                        { colid: "SKXX", colname: "上课时间", isshow: true, istip: false, width: "160" },
                        { colid: "jse", colname: "上课教室", isshow: true, istip: false },
                        { colid: "dkyy", colname: "代课原因", isshow: true, istip: true },
                        { colid: "CRDate", colname: "申请时间", isshow: true, istip: true },
                        { colid: "shsj", colname: "审核时间", isshow: true, istip: true },
                        { colid: "shyj", colname: "审核意见", isshow: true, istip: true },
                        { colid: "xbmc", colname: "系部名称", isshow: true, istip: true },
                        { colid: "xq", colname: "学期", isshow: true, istip: true, nosort: true },


                    ]
                }
            }
        },
        methods: {
            handleSelectionChange(val) {
                this.tableop.multipleSelection = val;
            },
            handleSelectionChange1(val) {
                this.tableop1.multipleSelection = val;
            },
            seljcf: function (jc) {
                this.seljc = jc;
            },
            shtkmodel: function () {
                $('#ZGModal').modal('show');
            },
           
            tksh: function (shzt) {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop.multipleSelection.length; i++) {
                    ids.push(this.tableop.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                $.getJSON('/API/VIEWAPI.ashx?Action=TKGL_TKSH', { P1: pro.query.xq.value, P2: pro.query.xb.value.join(), idns: ids.join(), shzt: pro.shzt, shyj: pro.shzt == "0" ? "不同意:" : "同意:" + pro.shyj }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.querydata();
                        $('#ZGModal').modal('hide');

                    }
                })

            },
            deltk: function () {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop.multipleSelection.length; i++) {
                    ids.push(this.tableop.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                pro.$confirm('是否确认要删除该调课信息?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.getJSON('/API/VIEWAPI.ashx?Action=TKGL_DELTKJL', { P1: pro.query.xq.value, P2: pro.query.xb.value.join(), idns: ids.join() }, function (resultData) {
                        if (!resultData.ErrorMsg) {
                            pro.$notify({
                                title: '成功',
                                message: '操作成功',
                                type: 'success'
                            });
                            pro.querydata();
                        }
                    })
                }).catch(() => {
                    pro.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            shdkmodel: function () {
                $('#ZGModal1').modal('show');
            },
            dksh: function (shzt) {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop1.multipleSelection.length; i++) {
                    ids.push(this.tableop1.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                $.getJSON('/API/VIEWAPI.ashx?Action=TKGL_DKSH', { P1: pro.query.xq.value, P2: pro.query.xb.value.join(), idns: ids.join(), shzt: pro.shztdk, shyj: pro.shztdk == "0" ? "不同意:" : "同意:" + pro.shyjdk }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.$notify({
                            title: '成功',
                            message: '操作成功',
                            type: 'success'
                        });
                        pro.querydata();
                        $('#ZGModal1').modal('hide');

                    }
                })

            },
            deldk: function () {
                var pro = this;
                var ids = [];
                for (var i = 0; i < this.tableop1.multipleSelection.length; i++) {
                    ids.push(this.tableop1.multipleSelection[i].idn);
                }
                if (ids.length == 0) {
                    this.$notify.error({
                        title: '错误',
                        message: '至少需要选择一条数据才能操作'
                    });
                    return;
                }
                pro.$confirm('是否确认要删除该代课信息?', '提示', {
                    confirmButtonText: '确定',
                    cancelButtonText: '取消',
                    type: 'warning'
                }).then(() => {
                    $.getJSON('/API/VIEWAPI.ashx?Action=TKGL_DELDKJL', { P1: pro.query.xq.value, P2: pro.query.xb.value.join(), idns: ids.join() }, function (resultData) {
                        if (!resultData.ErrorMsg) {
                            pro.$notify({
                                title: '成功',
                                message: '操作成功',
                                type: 'success'
                            });
                            pro.querydata();
                        }
                    })
                }).catch(() => {
                    pro.$message({
                        type: 'info',
                        message: '已取消删除'
                    });
                });
            },
            querydata: function () {
                var pro = this;
                pro.tableop.loading = true;
                pro.tableop1.loading = true;

                $.getJSON('/API/VIEWAPI.ashx?Action=TKGL_GETSHTK', { P1: pro.query.xq.value, P2: pro.query.xb.value.join(), shzt: pro.query.shzt }, function (resultData) {
                    if (!resultData.ErrorMsg) {
                        pro.tableop.dataset = resultData.Result;
                        pro.tableop1.dataset = resultData.Result1;

                        pro.tableop.loading = false;
                        pro.tableop1.loading = false;

                    }
                })
            },
            InitWigetData: function () {
                this.querydata();
            },
        },
        watch: {
            'query': { //深度监听，可监听到对象、数组的变化
                handler(newV, oldV) {
                    var chi = this;
                    if (newV) {
                        chi.querydata();
                    }
                },
                deep: true
            }
        },
        mounted: function () {
            var pro = this;
            pro.$nextTick(function () {
                //pro.InitWigetData();
            })

        }
    };
</script>